package com.cskaoyan.dbutils;

import com.cskaoyan.datasource.opensource.DruidUtils;
import com.cskaoyan.dbutils.impl.MyResultSetHandler;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import javax.swing.text.html.CSS;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * 创建日期: 2022/06/05 17:36
 *
 * @author ciggar
 *
 * resultSetHandler
 */
public class DBUtilsDemo2 {


    public static void main(String[] args) throws SQLException {

        // 创建一个QueryRunner ， 传入数据库连接池
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());


        List<Cskaoyan> list = queryRunner.query("select * from cskaoyan where teacher_name = ? or nickname = ?",
                new MyResultSetHandler(),"长风","奶茶哥哥");

        System.out.println(list);

    }
}
